package com.lh.util.dao;

import com.lh.HaversineToDist;

public class Edge {
    private Vertex vertex1;
    private Vertex vertex2;
    private Double distance;

    public Vertex getVertex1() {
        return vertex1;
    }

    public void setVertex1(Vertex vertex1) {
        this.vertex1 = vertex1;
    }

    public Vertex getVertex2() {
        return vertex2;
    }

    public void setVertex2(Vertex vertex2) {
        this.vertex2 = vertex2;
    }

    public Double getDistance() {
        return distance;
    }


    public Edge(Vertex vertex1, Vertex vertex2) {
        this.vertex1 = vertex1;
        this.vertex2 = vertex2;
        double lat1 = vertex1.getLatitude();
        double lat2 = vertex2.getLatitude();
        double long1 = vertex1.getLongitude();
        double long2 = vertex2.getLongitude();
        this.distance = HaversineToDist.haversine(lat1, long1, lat2, long2);
    }
}
